home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************************************
- 6/96 bob Updated #includes to support changed GX Library names.
-
- ©1990 - 1996 Apple Computer, Inc.
- All rights reserved.
- ****************************************************************************************************/
- #include <Types.h>
- #include <QuickDraw.h>
- #include <Fonts.h>
- #include <Windows.h>
- #include <Menus.h>
- #include <SegLoad.h>
- #include <Memory.h>
- #include <Desk.h>
-
- #include <GXGraphics.h>
- #include "GraphicsLibraries.h"
- #include <GXEnvironment.h>
-
- #include <GXTypes.h>
- #include <GXLayout.h>
- #include "LayoutLibrary.h"
-
- #include "SampleInterface.h"
-
- short MyStrLen(char *x);
- static short MyStrLen(x)
- char *x;
- {
- short c = 0;
- while (*x++) c++;
- return c;
- } /* MyStrLen */
-
- void LetterSpacing(WindowPtr sampleWindow)
- {
- /* Variables */
- char *myString = "AAABBBBAAA";
- gxPoint myPoint;
- gxRunControls gxRunControls;
- gxShape layout;
- short len, level = 0, runLengths[3];
- gxStyle regularStyle, tweakedStyle, styleArray[3];
- gxViewPort aViewPort;
-
- /* Initialization */
-
- myPoint.x = ff(30);
- myPoint.y = ff(50);
-
- /* Standard opening game */
-
- aViewPort = GXNewWindowViewPort(sampleWindow);
- SetDefaultViewPort(aViewPort);
-
- len = MyStrLen(myString);
- runLengths[0] = runLengths[2] = 3;
- runLengths[1] = 4;
-
- regularStyle = NewLayoutStyle((char *) "\pHoefler Text", ff(50), 0, nil, nil, 0, nil);
- tweakedStyle = NewLayoutStyle((char *) "\pHoefler Text", ff(50), 0, nil, nil, 0, nil);
-
- styleArray[0] = styleArray[2] = regularStyle;
- styleArray[1] = tweakedStyle;
-
- layout = GXNewLayout(
- 1, &len, (void *) &myString,
- 3, runLengths, styleArray,
- 1, &len, &level,
- nil, &myPoint);
- GXDrawShape(layout);
-
- InitializeRunControls(&gxRunControls);
- gxRunControls.beforeWithStreamShift = ff(10);
- GXSetStyleRunControls(tweakedStyle, &gxRunControls);
- GXMoveShape(layout, 0, ff(100));
- GXDrawShape(layout);
-
- gxRunControls.beforeWithStreamShift = 0;
- gxRunControls.afterWithStreamShift = ff(10);
- GXSetStyleRunControls(tweakedStyle, &gxRunControls);
- GXMoveShape(layout, 0, ff(100));
- GXDrawShape(layout);
-
- gxRunControls.afterWithStreamShift = 0;
- gxRunControls.crossStreamShift = ff(10);
- GXSetStyleRunControls(tweakedStyle, &gxRunControls);
- GXMoveShape(layout, 0, ff(100));
- GXDrawShape(layout);
-
- GXDisposeShape(layout);
- GXDisposeStyle(regularStyle);
- GXDisposeStyle(tweakedStyle);
- GXDisposeViewPort(aViewPort);
- } /* main */
-